using Hotel.BLL;
using Hotel.DAL;
using Microsoft.EntityFrameworkCore;

var builder = WebApplication.CreateBuilder(args);

// Add services to the container.

builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();

builder.Services.AddScoped<adminDAL>();
builder.Services.AddScoped<adminBLL>();


builder.Services.AddScoped<DisDAL>();
builder.Services.AddScoped<DisBLL>();


builder.Services.AddScoped<ShopDAL>();
builder.Services.AddScoped<ShopBLL>();

builder.Services.AddControllers().AddJsonOptions(x => x.JsonSerializerOptions.PropertyNamingPolicy = null);
builder.Services.AddDbContext<HotelConText>(x=>x.UseSqlServer(builder.Configuration.GetConnectionString("db")));

var app = builder.Build();
app.UseCors(x => x.AllowAnyOrigin().AllowAnyHeader().AllowAnyMethod());


// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
    app.UseSwagger();
    app.UseSwaggerUI();
}

app.UseStaticFiles();


app.UseHttpsRedirection();

app.UseAuthorization();

app.MapControllers();

app.Run();
